<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of questionanswerclss
 *
 * @author Miss
 */
include_once("adb.php");
class questionanswerclss extends adb {
    

    function questionanswerclss(){
			adb::adb();
		}
		
		/**
		*query all applicant in the table and store the dataset in $this->result	
		*@return if successful true else false
		*/
		
		function get_answerid_by_question($id){
			$query="Select aid from questionanswer where qid= $id";
			return $this->query($query);
		}
			
		function add_question_and_answer($qid, $aid)
                {
			$query ="Insert into questionanswer (qid,aid) values ($qid,$aid)";
			return $this->query($query);
		}
                
                function get_answer_by_id($id)
                {
                    $query="Select name from questionanswer inner join answers on answers.aid = questionanswer.aid where qid= $id";
                    //print $query;
                    return $this->query($query);
                }
                
                function search($search)
                {
                        $query = "Select name from questions where name like '%$search%'";                     
                        return $this->query($query);                   
                }
    
}
